package com.gosophia.metadataEngine.dao;


import java.util.Map;


import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import com.gosophia.commons.persistence.HibernateRepository;
/**
 * 读取接入系统的表数据所用dao
 * @author mayue
 *
 */
@Repository("businessDataDao")
public class BusinessDataDao extends HibernateRepository<Map<String,Object>,Long>{

    /**
     * 设置sessionFactory
     */
    @Override
    public void setSessionFactory(final SessionFactory sessionFactory) {
        if(sessionFactory!=null && !sessionFactory.isClosed()){
            sessionFactory.close();
        }
        super.sessionFactory = sessionFactory;
        
        Session session = getSession();
        if(!session.getTransaction().isActive()){
            session.beginTransaction();
        }
    }
}
